10 DEFINT A-Z:DIM ROMAN$(30):FOR I=0 TO 29:READ ROMAN$(I):NEXT I
20 SL=100:WHILE SL>0:CLS
30 PRINT "1. 9x9 Multiplication Table"
31 PRINT "2. Fibonacci Sequene"
32 PRINT "3. Prime Numbers"
33 PRINT "4. YangHui Triangle"
34 PRINT "5. Roman Number"
35 PRINT "6. GCD"
36 PRINT "7. Tower of Hanoi Solver"
37 PRINT "0. Quit"
40 INPUT "Select:",SL
50 IF SL>0 AND SL<=7 THEN ON SL GOSUB 100,200,300,400,500,600,700:GOSUB 90
80 WEND:CLS:END
90 PRINT "Press any key to continue";:WHILE INPUT$(1)="":WEND:RETURN
100 FOR A=1 TO 9
110 FOR B=1 TO A
120 PRINT HEX$(A);"x";HEX$(B);"=";MID$(STR$(A*B),2,2);CHR$(9);
130 NEXT B
140 PRINT ""
150 NEXT A
160 RETURN
200 A=1:B=1:PRINT USING "########";A;B;
210 FOR I=1 TO 21
220 T=A:A=B:B=B+T
230 PRINT USING "########";B;
240 NEXT I
250 PRINT "":RETURN
300 DIM P(128):C=1:P(0)=3:M=2000:N=3
310 PRINT USING "#####";2;:WHILE N<M
320 I=1:A=1:WHILE I<C AND P(I)*P(I)<=N AND A=1
330 IF (N MOD P(I))=0 THEN A=0
340 I=I+1:WEND
350 IF A=1 THEN PRINT USING "#####";N;:IF C<128 THEN P(C)=N:C=C+1
360 N=N+2:WEND
370 RETURN
400 S=14:FOR X=0 TO S
410 A=1:FOR Y=0 TO X
420 PRINT USING "#####";A;
430 A=A*(X-Y)\(Y+1)
440 NEXT Y
450 PRINT "":NEXT X
460 RETURN
500 INPUT "Input number:",N
510 IF N>3999 OR N<1 THEN PRINT "Invalid Number.":RETURN
520 P=0:RES$="":WHILE N>0: D=N MOD 10
530 IF D>0 THEN RES$=ROMAN$(P*9+D-1)+RES$
540 P=P+1:N=N\10:WEND
550 PRINT "Roman number:";RES$:RETURN
600 INPUT "A,B:",A,B
610 IF A>B THEN T=A:A=B:B=T
620 WHILE B<>0
630 T=A MOD B:A=B:B=T
640 WEND
650 PRINT "GCD:";A
660 RETURN
700 INPUT "Layers (3-14): ",N:IF N<3 OR N>14 THEN PRINT "Out of range.":RETURN
710 STEPS=2^N-1:ST=1:FIN=STEPS:PRINT "Total steps:";STEPS
720 INPUT "Steps range (Start, End):",ST,FIN
725 IF ST<1 OR ST>FIN OR FIN>STEPS THEN PRINT "Invalid steps range.":RETURN
730 CNT=1:FOR X=ST TO FIN:IF (N AND 1)=0 THEN T$="ACB" ELSE T$="ABC"
740 S=(X AND (X-1)) MOD 3:D=((X OR (X-1))+1) MOD 3
750 PRINT USING "#####:";X;:PRINT MID$(T$,S+1,1);"->";MID$(T$,D+1,1);"  ";
760 IF (CNT MOD 6)=0 THEN PRINT ""
770 IF (CNT MOD (23*6))=0 AND X<>FIN THEN GOSUB 90:PRINT ""
780 CNT=CNT+1: NEXT X:IF ((CNT-1) MOD 6)<>0 THEN PRINT ""
790 RETURN
1001 DATA "I","II","III","IV","V","VI","VII","VIII","IX"
1002 DATA "X","XX","XXX","XL","L","LX","LXX","LXXX","XC"
1003 DATA "C","CC","CCC","CD","D","DC","DCC","DCCC","CM","M","MM","MMM"

